home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
500 MB Nyheder Direkte fra Internet 9
/
500 MB nyheder direkte fra internet CD 9.iso
/
start
/
zipped
/
dos
/
clipper
/
poink.prg
< prev
next >
Wrap
Text File
|
1996-01-04
|
5KB
|
148 lines
//----------------------------------------------------------------------------
// Name: Poink.prg
// Purpose: bounce a bmpfile around the screen / need vga display
//
// Author: Esteban Castorena Osuna
// Date created: 12-08-95
// Copyright: Naaaaa
//
// Syntax: Poink(bmpfile [,speedinX] [,speedinY]) --> NIL
//
// Return Value: NIL
//
// Description: bounces a bmpfile around the screen
//
// Note: speedinX is Delta X
// speedinY is Delta Y
//
// WORKS ONLY WITH CA-CLIPPER 5.3
//
// EXOSPACE FI POINK LIB LLIBG
//
// Have some other nice libs will be contributing later
// Tell me if you liked it or if you have some other
// libs to share with me.
// CIS : 75061,417
//
//----------------------------------------------------------------------------
#define nwait .01 // seconds to wait between displays
#define xincrement 1 // increment xN between displays
#define yincrement 1 // increment yN between displays
#define screenw 639 // screen witdh 640-1 starts at 0
#define screenh 479 // screen height 480-1 starts at 0
static bmp,x,y,xincr,yincr,xold,yold,iwidth,iheight,direction:=1
// 1 fowards down
// 2 fowards up
// 3 backwards down
// 4 backwards up
func Poink(newbmp,speedx,speedy)
Local nkey
cls
if newbmp<>NIL .and. File(newbmp)
bmp := gbmpload(newbmp) // load bmp
else
? "Can't seem to find any bmp to display"
quit
endif
iwidth = bmp[1] // bmp's width
iheight = bmp[2] // bmp's height
set videomode to 18
set cursor off
x=0 ; y=0 // inicial position
xincr = if(speedx==NIL,xincrement,val(speedx))
yincr = if(speedy==NIL,yincrement,val(speedy))
xold = x ; yold = y
gbmpdisp(bmp,x,y)
nkey = fowdn()
do while .t. .and. nkey == 0
do case
case direction == 1
nkey = if( x >= screenw-iwidth, bakdn(),fowup())
case direction == 2
nkey = if( x >= screenw-iwidth, bakup(),fowdn())
case direction == 3
nkey = if( y >= screenh-iheight,bakup(),fowdn())
case direction == 4
nkey = if( x <= 0 ,fowup(),bakdn())
endcase
if nkey<>0 ; exit ; endif
enddo
cls
set videomode to 3
set cursor on
retu nkey
stat func fowdn
local nkey:=0
do while x < screenw-iwidth .and. y < screenh-iheight
nkey:=inkey(nwait)
if (x+xincr+iwidth )>screenw ; x = screenw-(xincr+iwidth ) ; endif
if (y+yincr+iheight)>screenh ; y = screenh-(yincr+iheight) ; endif
x+=xincr ; y+=yincr
gbmpdisp(bmp,x,y)
grect(xold,yold,xold+iwidth,y ,.t.,0,-1)
grect(xold,y ,x ,yold+iheight,.t.,0,-1)
xold = x ; yold = y
if nkey<>0 ; exit ; endif
enddo
direction = 1
retu nkey
stat func fowup
local nkey:=0
do while x < screenw-iwidth .and. y > 0
nkey:=inkey(nwait)
if (x+xincr+iwidth )>screenw ; x = screenw-(xincr+iwidth ) ; endif
if (y-yincr) < 0 ; y = yincr ; endif
x+=xincr ; y-=yincr
gbmpdisp(bmp,x,y)
grect(xold,y ,x ,y+iheight ,.t.,0,-1)
grect(xold,y+iheight,xold+iwidth,yold+iheight,.t.,0,-1)
xold = x ; yold = y
if nkey<>0 ; exit ; endif
enddo
direction = 2
retu nkey
stat func bakdn
local nkey:=0
do while x > 0 .and. y < screenh-iheight
nkey:=inkey(nwait)
if (x-xincr) < 0 ; x = xincr ; endif
if (y+yincr+iheight)>screenh ; y = screenh-(yincr+iheight) ; endif
x-=xincr ; y+=yincr
gbmpdisp(bmp,x,y)
grect(xold ,yold,xold+iwidth,y ,.t.,0,-1)
grect(x+iwidth,y ,xold+iwidth,yold+ iheight,.t.,0,-1)
xold = x ; yold = y
if nkey<>0 ; exit ; endif
enddo
direction = 3
retu nkey
stat func bakup
local nkey:=0
do while x > 0 .and. y > 0
nkey:=inkey(nwait)
if (x-xincr) < 0 ; x = xincr ; endif
if (y-yincr) < 0 ; y = yincr ; endif
x-=xincr ; y-=yincr
gbmpdisp(bmp,x,y)
grect(x+iwidth,yold ,xold+iwidth,y+iheight ,.t.,0,-1)
grect(xold ,y+iheight,xold+iwidth,yold+iheight,.t.,0,-1)
xold = x ; yold = y
if nkey<>0 ; exit ; endif
enddo
direction = 4
retu nkey
*** End of Poink()